local skel = fk.CreateSkill {
  name = "emo__shangzao",
  max_turn_use_time = 1,
}

Fk:loadTranslationTable{
  ["emo__shangzao"] = "赏枣",
  [":emo__shangzao"] = "每回合限一次，你造成伤害后，你可以令受伤角色获得1点护甲并摸两张牌。",

  ["#emo__shangzao-ask"] = "赏枣:你可以令 %src 获得1点护甲并摸两张牌",
}

skel:addEffect(fk.Damage, {
  anim_type = "support",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and not data.to.dead
    and player:usedSkillTimes(skel.name) == 0
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    if room:askToSkillInvoke(player, {
      skill_name = skel.name, prompt = "#emo__shangzao-ask:" .. data.to.id
    }) then
      event:setCostData(self, {tos = {data.to} })
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local to = data.to
    room:changeShield(to, 1)
    if to:isAlive() then
      to:drawCards(2, skel.name)
    end
  end,
})

return skel
